home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / tip / figinpar.tip < prev    next >
Text File  |  1993-09-15  |  2KB  |  60 lines

  1. % This macro source file is from the four volume series
  2. % "TeX in Practice" by Stephan von Bechtolsheim, published
  3. % 1993 by Springer-Verlag, New York.
  4. % Copyright 1993 Stephan von Bechtolsheim.
  5. % No warranty or liability is assumed.
  6. % This macro may be copied freely if no fees other than
  7. % media cost or shipping charges are charged and as long
  8. % as this copyright and the following source code itself
  9. % is not changed. Please see the series for further information.
  10. %
  11. % Version: 1.0
  12. % Date: May 1, 1993
  13. %
  14. %
  15. % This source code is documented in 12.3.2, p. II-116.
  16. % Original source in file "par3.TEX", starting line 558.
  17. \wlog{L: "figinpar.tip" ["par3.TEX," l. 558, p. II-116]}%
  18. % This file DOES belong to format "texip."
  19. \InputD{sumhd.tip}
  20. \InputD{box-mac.tip}
  21. \InputD{freespac.tip}
  22. \def\FigureInPar #1#2#3#4#5{% 
  23.     \par
  24.     \message{\string\FigureInPar: start}%
  25.     {%
  26.         \setbox 0 = \vbox{#1}
  27.         \OverallSize{\dimen0}{0}%
  28.         \advance\dimen0 by #2
  29.         \advance\dimen0 by #3
  30.         \advance\dimen0 by #4
  31.         \advance\dimen0 by #4
  32.         \advance\dimen0 by \parskip
  33.         \message{\string\FigureInPar:
  34.             available space: \the\FreePageSpace}%
  35.         \setbox 0 = \HboxR{\EmptyBox{#2}{0pt}{\hsize}}%
  36.         \ifdim\FreeSpaceConditional < \dimen0
  37.             \message{\string\FigureInPar:
  38.                 insufficient space: make it a \string\topinsert.}%
  39.             #1\unskip
  40.             \space
  41.             #5%
  42.             \par
  43.             \topinsert
  44.                 \box0
  45.             \endinsert
  46.         \else
  47.             \message{\string\FigureInPar:
  48.                 Sufficient space: put it here.}%
  49.             #1\unskip
  50.             \space
  51.             \vadjust{%
  52.                 \vskip #4
  53.                 \box0
  54.                 \vskip #4
  55.             }% 
  56.             #5\par
  57.         \fi
  58.     }
  59. }
  60.